package chapter1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Escape2 {
    public static void main(String[] args) {
        int[] arrar = new int []{1,2,3};
        List<String> list = new ArrayList<String>();
        list.add("top");
        list.add("middle");
        list.add("botton");
        //基本for循环
        for(int i=0;i<arrar.length;i++){
            System.out.println(arrar[i]);
        }
        //相当于while循环(iterator.hasNext()) 建议for循环
        Iterator<String> iterator = list.iterator();
        for(;iterator.hasNext();){
            System.out.println(iterator.next());
        }
        //加强for循环
        for(int i:arrar){
            System.out.println(i);
        }
        for(String s:list){
            System.out.println(s);
        }
    }
}
